package com.yunxi.module.system.mapper.notice;

import com.yunxi.framework.common.pojo.PageResult;
import com.yunxi.framework.mybatis.core.mapper.BaseMapperX;
import com.yunxi.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yunxi.module.system.model.notice.NoticeDO;
import com.yunxi.module.system.vo.admin.notify.message.notice.NoticePageReqVO;
import org.apache.ibatis.annotations.Mapper;

/**
 * <p>
 * 通知/公告 mapper
 * </p>
 *
 * @author lidy
 * @since 2024-05-08
 */
@Mapper
public interface NoticeMapper extends BaseMapperX<NoticeDO> {

    /**
     * 获得通知公告分页列表哦
     *
     * @param reqVO 查询条件
     * @return 分页列表
     */
    default PageResult<NoticeDO> selectPage(NoticePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<NoticeDO>()
                .likeIfPresent(NoticeDO::getTitle, reqVO.getTitle())
                .eqIfPresent(NoticeDO::getStatus, reqVO.getStatus())
                .orderByDesc(NoticeDO::getId));
    }
}
